//package com.alon.spring01.common.aop;
//
//
//import com.alibaba.fastjson.JSON;
//
//
//
//import org.aspectj.lang.ProceedingJoinPoint;
//import org.aspectj.lang.annotation.Around;
//import org.aspectj.lang.annotation.Aspect;
//import org.joda.time.DateTime;
//import org.joda.time.Interval;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.core.annotation.Order;
//
///**
// * @program: spring01
// * @description: 日志切面配置类
// * @author: yulongguang
// * @create: 2019-05-06 15:14
// **/
//@Aspect
//@Order(1)
//@Configuration
//public class LogAspect {
//    private static Logger logger = LoggerFactory.getLogger(LogAspect.class);
//
//    @Around("execution (public * com.alon.spring01.mapper..*.*(..))")
//    public Object apiLogAop(ProceedingJoinPoint point) throws Throwable {
//        logger.info("日志统一打印 ===== {}.{}() start =====,参数:{}", new Object[]{point.getSignature().getDeclaringTypeName(), point.getSignature().getName(), this.argsToString(point.getArgs())});
//        DateTime startTime = new DateTime();
//        DateTime endTime = null;
//        Interval interval = null;
//        Object response = null;
//
//        try {
//            response = point.proceed();
//        } catch (Exception var7) {
//            logger.error("", var7);
//            endTime = new DateTime();
//            interval = new Interval(startTime, endTime);
//            logger.info("日志统一打印 ===== {}.{}() end =====,响应时间:{}毫秒,响应内容:{}", new Object[]{point.getSignature().getDeclaringTypeName(), point.getSignature().getName(), interval.toDurationMillis()});
//            throw var7;
//        }
//
//        endTime = new DateTime();
//        interval = new Interval(startTime, endTime);
//        logger.info("日志统一打印 ===== {}.{}() end =====,响应时间:{}毫秒,响应内容:{}", new Object[]{point.getSignature().getDeclaringTypeName(), point.getSignature().getName(), interval.toDurationMillis(), this.argsToString(response)});
//        return response;
//    }
//
//    private String argsToString(Object object) {
//        try {
//            return JSON.toJSONString(object);
//        } catch (Exception var3) {
//            logger.error("", var3);
//            return String.valueOf(object);
//        }
//    }
//
//}
